from typing import Optional

from app.crud import CRUDBase
from app.expert.models import Expert
from app.expert.schemas import ExpertCreate, ExpertUpdate


class CRUDExpert(CRUDBase[Expert, ExpertCreate, ExpertUpdate]):
    async def get(self, id: int) -> Optional[Expert]:
        get_expert = await self.model.objects.select_related("expertises").get_or_none(pk=id)
        return get_expert
        # return super().get(id)


expert = CRUDExpert(Expert)
